<?php include '../../common/view/header.html.php'; ?>
<?php include '../../common/view/datepicker.html.php'; ?>
<style type="text/css">
    .bold {
        font-weight: bold;
    }
</style>
<div id='mainContent' class='main-row'>
    <div class='side-col col-lg'>
        <?php include 'blockreportlist.html.php'; ?>
    </div>
    <div class='main-col'>
        <div class='cell'>
            <div class="table-row" id='conditions'>
                <div class='col-sm-3'>
                    <div class='input-group'>
                        <span class='input-group-addon'><?php echo $lang->report->project; ?></span>
                        <?php echo html::select('project', $projects, $project, "class='form-control chosen' onchange='changeParams(this)'"); ?>
                    </div>
                </div>
                <div class='col-sm-3'>
                    <div class='input-group'>
                        <span class='input-group-addon'><?php echo $lang->report->dept; ?></span>
                        <?php echo html::select('dept', $depts, $dept, "class='form-control chosen' onchange='changeParams(this)'"); ?>
                    </div>
                </div>
                <div class='input-group w-400px input-group-sm'>
                    <span class='input-group-addon'><?php echo $lang->projectCommon . $lang->report->taskOverData; ?></span>
                    <div class='datepicker-wrapper datepicker-date'><?php echo html::input('begin', $begin, "class='form-control form-date' onchange='changeDate(this.value, \"$end\")'"); ?></div>
                    <span class='input-group-addon'><?php echo $lang->report->to; ?></span>
                    <div class='datepicker-wrapper datepicker-date'><?php echo html::input('end', $end, "class='form-control form-date' onchange='changeDate(\"$begin\", this.value)'"); ?></div>
                </div>
            </div>
        </div>
        <?php if (empty($projects)): ?>
            <div class="cell">
                <div class="table-empty-tip">
                    <p><span class="text-muted"><?php echo $lang->error->noData; ?></span></p>
                </div>
            </div>
        <?php else: ?>
            <div class='cell'>
                <div class='panel'>
                    <div class="panel-heading">
                        <div class="panel-title"><?php echo $title; ?></div>
                        <?php
                        $checkObject = new stdclass();
                        $checkObject->project = 0;
                        $totalProjectTime = 0;
                        ?>
                        <nav class="panel-actions btn-toolbar"><?php if (common::hasPriv('report', 'export', $checkObject)) echo html::submitButton($lang->report->export, '', 'btn btn-primary btn-block'); ?></nav>
                    </div>
                    <div data-ride='table'>
                        <table class='table table-condensed table-striped table-bordered table-fixed no-margin table-hover'
                               id='projectSummary'>
                            <thead>
                            <tr class='colhead'>
                                <th class="w-200px"><?php echo $lang->report->code; ?></th>
                                <th><?php echo $lang->report->projectName; ?></th>
                                <th class="w-100px"><?php echo $lang->report->projectsTotal; ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($projectSummary as $id => $project): ?>
                                <tr class="text-center">
                                    <td class="text-left w-200px"><?php echo $project->code ?></td>
                                    <td class="text-left"><div data-toggle="tooltip" data-placement="left" title="<?php echo $project->name; ?>"><?php echo html::a($this->createLink('project', 'view', "projectID=$id"), $project->name); ?></div></td>
                                    <td><?php echo $project->consumed; $totalProjectTime += $project->consumed; ?></td>
                                </tr>
                            <?php endforeach; ?>
                            <tr>
                                <td class="text-center bold">合计</td>
                                <td></td>
                                <td class="text-right bold"><?php echo  $totalProjectTime; ?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
